package cn.tedu.review;
/*本类用于复习多态*/
public class TestDemo {
    public static void main(String[] args) {
        /*父类引用指向子类对象*/
        Animal a = new Dog();
        a.eat();/*使用的方法是父类的声明,子类的方法体*/
        System.out.println(a.sum);
    }
}
class Animal{
    int sum =10;
    public void eat(){
        System.out.println("吃啥都行");
    }
}
class Dog extends Animal{
    int sum =100;
    @Override
    public void eat(){
        System.out.println("小狗爱吃狗肉包子");
    }
}